package cn.iotab.iotkit.transport.api.access.handler.adaptor;

import cn.iotab.iotkit.transport.api.access.device.HandlerManager;
import cn.iotab.iotkit.transport.api.access.handler.ToServerRpcHandler;
import cn.iotab.iotkit.transport.api.common.message.msg.rpc.AuthBasicRequestMsg;
import cn.iotab.iotkit.transport.api.common.message.msg.rpc.AuthResponseMsg;
import cn.iotab.iotkit.transport.api.common.message.msg.rpc.AuthX509RequestMsg;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ToServerRpcHandlerAdaptor {

    private final ToServerRpcHandler handler;

    public ToServerRpcHandlerAdaptor(HandlerManager handlerManager) {
        this.handler = handlerManager.getToServerRpcHandler();
    }

    public ListenableFuture<AuthResponseMsg> onBasicAuth(AuthBasicRequestMsg msg){
        return handler.onBasicAuth(msg);
    }

    public ListenableFuture<AuthResponseMsg> onX509Auth(AuthX509RequestMsg msg){
        return handler.onX509Auth(msg);
    }

}
